package com.april.pattern.creational.prototype;

import java.util.Date;

/**
 * @author April
 * @version V1.0.0
 * @date 2019/06/23 13:14
 * @description
 */
public class SheepTwo implements Cloneable {

    private String name;
    private Date birthday;

    public SheepTwo(String name, Date birthday) {
        this.name = name;
        this.birthday = birthday;
    }

    /**
     * 实现深复制
     *
     * @return
     * @throws CloneNotSupportedException
     */
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Object object = super.clone();
        SheepTwo sheepTwo = (SheepTwo) object;
        sheepTwo.birthday = (Date) this.birthday.clone();
        return object;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
}
